package com.learn.security.common.constant;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;

import java.util.List;

/**
 * created by yuanjunjie on 2019/1/3 5:22 PM
 */
public interface CommonConstants {

    /**
     * 成功标记
     */
    Integer SUCCESS=0;
    /**
     * 失败标记
     */
    Integer FAIL=1;

    /**
     * 编码
     */
    String UTF8 = "UTF-8";


    /**
     * 路由存放
     */
    String ROUTE_KEY = "commsat_gateway_route_key";

    /**
     * 验证码前缀
     */
    String VALIDATE_CODE_KEY = "VALIDATE_CODE_KEY_";



    /**
     * 数据库软删除标记
     */
    interface DelFlag {
        /**
         * 正常
         */
        Integer normal = 0;

        /**
         * 删除
         */
        Integer del = -1;
    }


    /**
     * 锁定标记
     */
    interface LockFlag {
        /**
         * 正常
         */
        String normal = "0";

        /**
         * 锁定
         */
        String lock = "1";
    }


    interface LogType {
        /**
         * 正常
         */
        String normal = "normal";

        /**
         * 异常
         */
        String exception = "exception";
    }

    interface Bool {
        Integer TRUE = 1;
        Integer FALSE = 0;
    }

    interface StringBool {
        String TRUE = "1";
        String FALSE = "0";

        static boolean isTrue(String b) {
            return StrUtil.equals(b, TRUE);
        }

        static boolean isFalse(String b) {
            return !isTrue(b);
        }
    }

}
